FROM php:8.1.28-cli-alpine3.19

LABEL Maintainer="Jianshan Liao (Sunline) <10775937@qq.com>" \
    Description="Webman docker images (PHP 8.1.28 CLI Alpine3.19)"

ENV ENV="/root/.ashrc"
COPY *.tgz /tmp/
COPY composer /usr/local/bin/

EXPOSE 8787

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
    && apk update && apk upgrade \
    && apk add --update --no-cache autoconf g++ gcc make \
    freetype freetype-dev libpng libpng-dev jpeg-dev \
    zlib-dev openssl-dev libmemcached-dev libevent libevent-dev \
    && docker-php-ext-install bcmath mysqli pdo_mysql fileinfo pcntl sockets \
    && cd /tmp \
    && pecl install redis-6.0.2.tgz \
    && pecl install mongodb-1.18.1.tgz \
    && pecl install memcached-3.2.0.tgz \
    && tar -xvf event-3.1.3.tgz && cd event-3.1.3 \
    && /usr/local/bin/phpize \
    && ./configure --with-event-core --with-event-extra \
    && make && make install \
    && docker-php-ext-enable redis memcached mongodb event \
    && docker-php-source delete \
    && cd /usr/local/etc/php/conf.d/ \
    && cat docker-php-ext-sockets.ini docker-php-ext-event.ini > docker-php-ext-sockets-event.ini \
    && rm -f docker-php-ext-sockets.ini docker-php-ext-event.ini \
    && rm -rf /tmp/*.tgz \
    && rm /tmp/pear -fr \
    && apk del autoconf g++ gcc make freetype-dev \
    && echo 'alias ll="ls -la --color=auto"' >> /root/.ashrc

# 构建镜像命令
# docker build -t  ziyo-php:8.1.28-cli-alpine3.19 .